package demo.java.springboot.mybatis.sys.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import demo.java.springboot.mybatis.sys.po.User;
import demo.java.springboot.mybatis.sys.service.UserService;

@RestController
@RequestMapping("/users")
public class UserController {

	@Resource
	private UserService userService;
	
	/**
	 * @param id
	 * @return
	 */
	@GetMapping("/{id}")
	User getUser (@PathVariable("id") String id) {
		return userService.getById (id);
	}
	
	@GetMapping
	List<User> getUsers () {
		return userService.getAll ();
	}
}
